﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web;
using System.Web.Http.Filters;

namespace ASPNETMVC4Tutorial.Filters
{
    public class NotImplExceptionFilterAttribute : ExceptionFilterAttribute 
    {
        public override void OnException(HttpActionExecutedContext context)
        {
            if (context.Exception is NotImplementedException)
            {
                //context.Response = new HttpResponseMessage(HttpStatusCode.NotImplemented);

                HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.NotImplemented)
                {
                    ReasonPhrase ="Method not implemented."

                };
                context.Response = response;
            }


        }
    }
}